export class LoadManager {
    static loadedCache: Map<string, cc.AudioClip> = new Map<string, cc.AudioClip>();
    static loadMusicEffect(path: string) {
        return new Promise<cc.AudioClip>((resolve, reject) => {
            if (this.loadedCache.has(path)) {
                const asset = this.loadedCache.get(path);
                if (cc.isValid(asset)) {
                    resolve(asset);
                    return;
                }
            } else {
                cc.resources.load(path, cc.AudioClip, (err, asset: cc.AudioClip) => {
                    if (err) {
                        reject(err);
                    }
                    this.loadedCache.set(path, asset)
                    resolve(asset);
                })
            }
        })
    }
}